package com.peng.leetcode.other;

/**
 * ClimbStairs
 *
 * @author: lupeng6
 * @create: 2020/12/16 14:29
 */
public class ClimbStairs {

    public static void main(String[] args) {
        System.out.println(new Solution().climbStairs(4));
    }

    static class Solution {
        public int climbStairs(int n) {
            int[] dpStates = new int[n + 1];
            dpStates[0] = 1;
            dpStates[1] = 1;
            for (int i = 2; i <= n; i++) {
                dpStates[i] = dpStates[i - 1] + dpStates[i - 2];
            }
            return dpStates[n];
        }
    }
}
